//
//  SinglePage.h
//  Dolphin
//
//  Created by Handymood on 11-5-22.
//  Copyright 2011 __Hanydmood__. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "SinglePageInfo.h"
#import "UIImageLayer.h"
#import "SimpleVideoPlayer.h"
#import "ButtonSlide.h"
#import "SimpleAudioPlayer.h"
#import "UIComponentBase.h"
#import "LayerInfo.h"

@class SinglePageInfo;
@class UIImageLayer;
@class SimpleVideoPlayer;
@class ButtonSlide;
@class SimpleAudioPlayer;
@class UIComponentBase;
@class LayerInfo;

@interface SinglePage : UIScrollView <UIScrollViewDelegate> 
{
    NSMutableSet *layers;
    UIView* contentHolder;
    
    int page_id;
    int layers_num;
    
    int bringToFrontTimeTick;
    
    BOOL hasMedia;
    BOOL mediaAutoPlay;
    int mediaIndex;
    
    CGFloat originalWidth;
    CGFloat originalHeight;
        
    BOOL useSpecificScroll;
    CGFloat scrollWidth;
    CGFloat scrollHeight;
    
    int resizeMode; //0:auto-fit screen size 1:auto-fit page size
}

-(void) addImage:(NSString *) imgPath 
                imgPos:(CGPoint) inPos
                imgSize:(CGSize)inSize 
                useOriginalSize:(BOOL) inUseOriginalSize
                ratioMode:(int) inRatioMode
                targetId:(int) inTargetId
                layerInfo:(LayerInfo *) singleLayerInfo;

-(void)addVideoPlayer:(NSString *)inVideoPath
                    videoPos:(CGPoint) inPos
                    videoSize:(CGSize )inSize
                     autoPlay:(BOOL) inAutoPlay 
                        isLoop:(BOOL) inLoop
                    layerInfo:(LayerInfo *) singleLayerInfo
    slideshowAutoPlay:(BOOL) isSlideshowAutoPlay
              slideBgmOn:(BOOL) isSlideBgmOn
                          fade:(BOOL) isFade;

-(void)addBtnSlide:(NSArray *)imgArray 
                slidePos:(CGPoint) inPos
                slideSize:(CGSize ) inSlideSize 
                imgSize:(CGSize ) inImgSize
                layerInfo:(LayerInfo *) singleLayerInfo;

-(void)addAudio:(NSString *)audioPath
           audioPos:(CGPoint) inPos
           autoPlay:(BOOL) inAutoPlay 
           isLoop:(BOOL) inLoop
           isButtonShow:(BOOL) inButtonShow
                  layerInfo:(LayerInfo *) singleLayerInfo;

-(void) initWithPageInfo:(SinglePageInfo *)singlePageInfo;
-(int) curLayersNum;
-(void) layoutAdjustWithOrientation:(UIInterfaceOrientation)interfaceOrientation
                   isLandScapeTwoPage:(BOOL) inLandScapeTwoPage
                                                isInit:(BOOL) inIsInit;
-(UIComponentBase *) getLayerAtIndex:(int) index;
-(void) active;
-(void) pause;
-(void) reset;

@property int page_id;
@property int layers_num;
@property BOOL hasMedia;
@property BOOL mediaAutoPlay;
@property int mediaIndex;
@property int resizeMode; 
@end
